package com.lxz.datasource.config.druid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource {
	
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Override
	protected Object determineCurrentLookupKey() {
		logger.debug("当前所选数据库:{}", DataSourceContextHolder.getDataSource());
		return DataSourceContextHolder.getDataSource();
	}
}
